home *** CD-ROM | disk | FTP | other *** search
- ---STRUC.DOC---
-
- The STRUC Directive
-
- The STRUC directive is used to define a template of data to be addressed by one
- of the 8086's base and/or index registers. The syntax of STRUC is as follows:
-
- (optional strucname) STRUC (optional effective address)
-
- The optional structure name given at the beginning of the line can appear
- in subsequent expressions in the program, with the operator TYPE applied to it,
- to yield the number of bytes in the structure template.
-
- The STRUC directive causes the assembler to enter a mode similar to DATA
- SEGMENT, with the optional addition of indexing: if an effective address, which
- can include base registers [BX] or [BP] and/or index registers [SI] or [DI],
- is given at the end of the STRUC line, all variables declared between STRUC and
- ENDS will be indexed by the effective address. For example:
-
- LINE STRUC [BP]
- DB 80 DUP (?)
- LSIZE DB ?
- LPROT DB ?
- ENDS
-
- The above STRUC defines the variables LSIZE, equivalent to [BP+80], and LPROT,
- equivalent to [BP+81]. You can now issue instructions such as MOV AL,LSIZE;
- which automatically generates the correct indexing for you.
-
- The mode entered by STRUC is terminated by the ENDS directive, which returns the
- assembler to whatever segment (CODE or DATA) it was in before the STRUC.
-